<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS Map</title>
</head>
<body>
<p>使用Map.forEach()：</p>
<p id="demo"></p>
<script>
  //创建Map
  const fruits = new Map([
          ["apples",500],
          ["bananas",300],
          ["oranges",200]
  ]);
  let text = "";
  fruits.forEach(function (value,key){
    text += key + ' = ' + value + "<br/>"
  })

  document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>